import lupa

lua = lupa.LuaRuntime()

lua_func = lua.eval(
    """
    function (obj, key)
        return obj[key]
    end
    """
)

d = {"a": 1, "name": "satori"}
print(lua_func(d, "a"))  # 1
print(lua_func(d, "name"))  # satori
